import os
import sys

import pexpect

os.environ["KKZone"] = "cn"
env = os.environ.get("KKZone")
print(env)
child = pexpect.spawn('/root/kk create cluster -f kk-cluster.yaml')
child.logfile = sys.stdout.buffer
once = True

while True:
    try:
        i = child.expect([" ", "yes"])
        if i == 1 and once:
            once = False
            child.expect([" "])
            child.sendline("yes")
    except:
        pass
        # print(str(child))